package Controller;

import DB.IFPointManager;
import DB.PointManager;
import Model.Point;
import Model.Scenario;
import java.util.ArrayList;

/**
 * PointController class is a controller class for MVC realisation 
 * @author V3nom
 */
public class PointController {
    private IFPointManager manager;
    
    public PointController(){
        manager = new PointManager();
    }
    
    /*
     * creates new Point object
     */
    public Point createPoint(){
        return new Point();
    }
    
    /*
     * Gets all points from the database by scenarioId which is extracted from provided
     * Scenario object
     */
    public ArrayList<Point> getPoints(Scenario scenario){
        return manager.getAllPoints(scenario);
    }
    
    /*
     * Saves point to database
     */
    public void savePoint(Point point, Scenario scenario){
        manager.savePoint(point, scenario);
    }
    
    /*
     * Deletes point from the database
     */
    public void deletePoint(Point point){
        manager.deletePoint(point);
    }
    
    /*
     * Saves all points to the database fom provided Scenario object
     */
    public void savePoints(Scenario scenario){
        manager.savePoints(scenario);
    }
    
    /*
     * Deletes all points to the database fom provided Scenario object
     */
    public void deletePoints(Scenario scenario){
        manager.deletePoints(scenario);
    }
}
